//
//  AppModel.swift
//  爱汽车
//
//  Created by tucici on 2024/5/20.
//

import UIKit
import SwiftyJSON

class AppModel: NSObject {
    @objc dynamic var forceUpdate = false
    @objc dynamic var ota = ""
    @objc dynamic var fileName = ""
    @objc dynamic var versionCode = 0
    @objc dynamic var content = ""
    @objc dynamic var version = ""
    @objc dynamic var localVersionCode : Int{
        return version.replacingOccurrences(of: ".", with: "").intValue()
    }
    
    class func json(_ jsonData:JSON)->AppModel{
        let s = AppModel()
        s.forceUpdate  = jsonData["forceUpdate"].boolValue
        s.ota   = jsonData["ota"].stringValue
        s.fileName  = jsonData["fileName"].stringValue
        s.versionCode   = jsonData["versionCode"].intValue
        s.content  = jsonData["content"].stringValue
        return s
    }
}
